From 721cc3f835fc506694aa1a4ad186471093634a5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 29 Jun 2014 20:15:11 +0200 Subject: [PATCH] extension: make rgb8 to rgba8 conversion faster For all pixels but the last one, do a 32bit load/store + 8bit immediate store instead of byte by byte copying. --- extensions/gggl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/extensions/gggl.c b/extensions/gggl.c index 29b4c51..5588759 100644 --- a/extensions/gggl.c +++ b/extensions/gggl.c @@ -943,20 +943,18 @@ conv_rgbA8_rgba8 (unsigned char *src, unsigned char *dst, long samples) static long conv_rgb8_rgba8 (unsigned char *src, unsigned char *dst, long samples) { - long n = samples; - + long n = samples-1; while (n--) { - /**(unsigned int *) dst = *(unsigned int *) src; - dst[3] = 255;*/ - - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; + *(unsigned int *) dst = *(unsigned int *) src; dst[3] = 255; src += 3; dst += 4; } + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = 255; return samples; } -- 2.30.2